<?php
require('lib/verify.php');
require('lib/has_char.php');
require('lib/is_approved.php');

$_category = "warmath";
$_title = "Raids";
require('lib/head.php');

$system_id = $system["system_id"];

$sql = "select *, wm_instances.instance_name from wm_raids left join wm_instances on wm_raids.raid_instance = wm_instances.instance_id where wm_raids.raid_system_id = $system_id order by raid_date desc";
$result = $db->query($sql);

boxTop("Warmath: $_title");

?>

<?php
   if($character["character_admin"]) {
     ?>
     (<?adminfeature()?> <a href="add-raid.php">add raid</a>)<br /><br />
<?php
   }
?>


<?php
while($raid = $db->fetch_assoc($result)) {

  $sql = "select *, wm_bosses.* from wm_credits left join wm_bosses on wm_bosses.boss_id = credit_boss where credit_raid = '" . $raid["raid_id"] . "' and credit_system_id = $system_id order by credit_date asc";
  $res = $db->query($sql);
  
?>

<a href="raid.php?id=<?=$raid["raid_id"]?>"><b><?=$raid["instance_name"]?></b>, <?=date("D d M Y", strtotime($raid["raid_date"]))?></a> <b>T<?=$system["system_tier"]?>R<?=$raid["raid_id"]?></b>
<br/>
<?php
   while($cred = $db->fetch_assoc($res)) {
?>
   &nbsp;   &nbsp;   &nbsp;<a href="credit.php?id=<?=$cred["credit_id"]?>"><?=$cred["boss_name"]?>, <?=date("g:i a", strtotime($cred["credit_date"]))?></a><br />
<?php
   }
?>
<br />
<?php
    }
?>

<?php
boxBot();
?>

<?php
require('lib/foot.php');
?>

